var rolePageCache={};
$('.dtree input[id^="c_"]').click(function(){
	if(this.checked){
		setChecked(this.value);
	}else{
		setUnChecked(this.value);
	}
});
var setChecked = function(id){
	$('.dtree input[id$="_'+id+'"]').each(function(){		
			document.getElementById(this.id).checked = true;
	});
}
var setUnChecked = function(id){
	$('.dtree input[id$="_'+id+'"]').each(function(){
			document.getElementById(this.id).checked= false;
	});
}
var getDtreeValues = function(){
	var tmp=[];
	$('.dtree input[id^="c_"]').each(function(){
		if(this.checked){
			tmp.push(this.value);
		}
	});
	return tmp.join(";");
}

var setDtreeValues = function(values){
	$('.dtree input').attr("checked",false);
	if(values== null){
		return;
	} 
	$('.dtree input').each(function(){
		if(values.indexOf(this.value)>-1){
			$(this).attr("checked",true);
		}
	});
}

var getDtreeRadioValue = function(){
	return $('.dtree :radio[checked="true"]').val();
}
var setDtreeRadioValue = function(value){
	$('#radioDtree_'+value).click();
}

